#include"namedPipe.hpp"

int main()
{
    NamedPipe fifo(comm_fifopath,Create);
    //读端打开文件但是写端没有打开文件会阻塞在open调用中知道写端打开
    if(fifo.OpenRead())
    {
        while(true)
        {
            std::string message;
            int n=fifo.ReadNamePipe(&message);
            if(n>0)
            {
                std::cout<<"read message:"<<message<<std::endl;
            }
            else if(n==0)
            {
                std::cout<<"client quit"<<std::endl;
                break;
            }
            else
            {
                std::cout<<"read error"<<std::endl;
                break;
            }
        }
    }
    
    return 0;
}